package map;

import java.util.HashMap;
import java.util.Map;

public class test {
    public static void main(String[] args) {
        String line = "i love java! thinking in java!! hello java!";
        Map<Character, Integer> map = new HashMap<>();
        //Integer value;

        int num = 0;
        for (int i = 0; i < line.length(); i++) {
            char c = line.charAt(i);
            if (map.containsKey(c)) {
                num = map.get(c);
                map.replace(c, num + 1);
            } else {
                map.put(line.charAt(i), 1);
            }
        }
        map.forEach((k, v) -> System.out.println(k + ":" + v));
    }
}
